<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增资源 - 1024导航后台</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        accent: '#F59E0B',
                        dark: '#1F2937',
                        light: '#F9FAFB',
                        danger: '#EF4444'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .card-hover {
                @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
            }
            .sidebar-active {
                @apply bg-primary/10 text-primary border-l-4 border-primary;
            }
            .form-input-focus {
                @apply focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary;
            }
        }
    </style>
</head>

<body class="bg-gray-50 font-sans text-gray-800">
    <div class="flex h-screen overflow-hidden">
        <!-- 侧边栏 -->
        <aside class="w-64 bg-white shadow-sm flex-shrink-0 hidden md:block overflow-y-auto">
            <div class="p-4 border-b border-gray-100">
                <div class="text-primary text-xl font-bold">1024<span class="text-secondary">管理后台</span></div>
            </div>

            <nav class="p-4 space-y-1">
                <a href="admin_index.html"
                    class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-tachometer w-5 text-center mr-3"></i>
                    <span>控制台</span>
                </a>
                <a href="admin_resource_manager.html"
                    class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-th-large w-5 text-center mr-3"></i>
                    <span>资源管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm sidebar-active rounded">
                    <i class="fa fa-plus-circle w-5 text-center mr-3"></i>
                    <span>新增资源</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-wrench w-5 text-center mr-3"></i>
                    <span>工具管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-users w-5 text-center mr-3"></i>
                    <span>用户管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-comments w-5 text-center mr-3"></i>
                    <span>评论管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-cog w-5 text-center mr-3"></i>
                    <span>系统设置</span>
                </a>
            </nav>
        </aside>

        <!-- 主内容区 -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- 顶部导航 -->
            <header class="bg-white shadow-sm border-b border-gray-200">
                <div class="container mx-auto px-4 py-3 flex justify-between items-center">
                    <button class="md:hidden text-gray-600 text-xl">
                        <i class="fa fa-bars"></i>
                    </button>

                    <div class="flex items-center space-x-4 ml-auto">
                        <div class="relative">
                            <button class="text-gray-600 hover:text-primary transition-colors">
                                <i class="fa fa-bell text-xl"></i>
                                <span
                                    class="absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full text-white text-xs flex items-center justify-center">3</span>
                            </button>
                        </div>

                        <div class="relative group">
                            <button
                                class="flex items-center space-x-2 px-3 py-1.5 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors">
                                <img src="https://picsum.photos/id/1005/40/40" alt="管理员头像"
                                    class="w-8 h-8 rounded-full object-cover">
                                <span class="hidden md:inline-block text-sm font-medium">管理员</span>
                                <i class="fa fa-angle-down text-gray-500"></i>
                            </button>
                            <div
                                class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg py-2 z-10 hidden group-hover:block">
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">个人中心</a>
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">账号设置</a>
                                <div class="border-t border-gray-100 my-1"></div>
                                <a href="#" class="block px-4 py-2 text-sm text-red-600 hover:bg-gray-100">退出登录</a>
                            </div>
                        </div>
                    </div>
                </div>
            </header>

            <!-- 页面内容 -->
            <main class="flex-1 overflow-y-auto bg-gray-50 p-4 md:p-6">
                <div class="max-w-4xl mx-auto">
                    <!-- 页面标题和操作 -->
                    <div class="mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
                        <div>
                            <h1 class="text-2xl font-bold text-gray-800">新增资源</h1>
                            <p class="text-gray-500 mt-1">添加新的互联网资源到平台</p>
                        </div>
                        <div class="flex gap-3">
                            <a href="admin_resource_manager.html"
                                class="px-4 py-2 border border-gray-300 rounded-md bg-white text-gray-700 hover:bg-gray-50 transition-colors">
                                <i class="fa fa-arrow-left mr-1"></i> 返回列表
                            </a>
                        </div>
                    </div>

                    <!-- 表单卡片 -->
                    <div class="bg-white rounded-xl shadow-sm p-6 mb-6">
                        <form id="resourceForm" class="space-y-6">
                            <!-- 基本信息 -->
                            <div>
                                <h2 class="text-lg font-bold text-gray-800 mb-4 flex items-center">
                                    <i class="fa fa-info-circle text-primary mr-2"></i>基本信息
                                </h2>
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                    <div>
                                        <label for="resourceName"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源名称 <span
                                                class="text-danger">*</span></label>
                                        <input type="text" id="resourceName" required
                                            class="w-full px-4 py-2 border border-gray-300 rounded-md form-input-focus"
                                            placeholder="请输入资源名称">
                                    </div>
                                    <div>
                                        <label for="resourceUrl"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源URL <span
                                                class="text-danger">*</span></label>
                                        <input type="url" id="resourceUrl" required
                                            class="w-full px-4 py-2 border border-gray-300 rounded-md form-input-focus"
                                            placeholder="请输入资源链接，以http://或https://开头">
                                    </div>
                                    <div>
                                        <label for="resourceCategory"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源分类 <span
                                                class="text-danger">*</span></label>
                                        <select id="resourceCategory" required
                                            class="w-full px-4 py-2 border border-gray-300 rounded-md form-input-focus">
                                            <option value="">请选择分类</option>
                                            <option value="dev">开发工具</option>
                                            <option value="design">设计资源</option>
                                            <option value="education">学习教育</option>
                                            <option value="entertainment">影音娱乐</option>
                                            <option value="shopping">电商购物</option>
                                            <option value="tools">实用工具</option>
                                            <option value="images">图片素材</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label for="resourceIcon"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源图标</label>
                                        <div class="flex items-center gap-3">
                                            <div
                                                class="w-10 h-10 rounded-lg bg-gray-100 flex items-center justify-center text-gray-500">
                                                <i class="fa fa-link"></i>
                                            </div>
                                            <input type="file" id="resourceIcon" accept="image/*"
                                                class="flex-1 text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-medium file:bg-primary/10 file:text-primary hover:file:bg-primary/20">
                                        </div>
                                        <p class="text-xs text-gray-500 mt-1">建议上传100x100像素的图片，支持PNG、JPG格式</p>
                                    </div>
                                </div>
                            </div>

                            <!-- 详细信息 -->
                            <div>
                                <h2 class="text-lg font-bold text-gray-800 mb-4 flex items-center">
                                    <i class="fa fa-file-text-o text-primary mr-2"></i>详细信息
                                </h2>
                                <div class="space-y-6">
                                    <div>
                                        <label for="resourceDescription"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源描述 <span
                                                class="text-danger">*</span></label>
                                        <textarea id="resourceDescription" rows="4" required
                                            class="w-full px-4 py-2 border border-gray-300 rounded-md form-input-focus"
                                            placeholder="请简要描述资源的功能、特点和使用场景（不超过200字）"></textarea>
                                        <p class="text-xs text-gray-500 mt-1">请确保描述准确简洁，有助于用户了解资源用途</p>
                                    </div>

                                    <div>
                                        <label for="resourceTags"
                                            class="block text-sm font-medium text-gray-700 mb-1">资源标签</label>
                                        <input type="text" id="resourceTags"
                                            class="w-full px-4 py-2 border border-gray-300 rounded-md form-input-focus"
                                            placeholder="请输入标签，多个标签用逗号分隔">
                                        <p class="text-xs text-gray-500 mt-1">例如：在线工具,设计,免费</p>
                                    </div>

                                    <div>
                                        <label class="block text-sm font-medium text-gray-700 mb-2">资源特性</label>
                                        <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3">
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">免费使用</span>
                                            </label>
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">无需注册</span>
                                            </label>
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">支持中文</span>
                                            </label>
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">无广告</span>
                                            </label>
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">可商用</span>
                                            </label>
                                            <label class="flex items-center">
                                                <input type="checkbox"
                                                    class="rounded border-gray-300 text-primary focus:ring-primary">
                                                <span class="ml-2 text-sm text-gray-700">开源</span>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!-- 审核设置 -->
                            <div>
                                <h2 class="text-lg font-bold text-gray-800 mb-4 flex items-center">
                                    <i class="fa fa-check-square-o text-primary mr-2"></i>审核设置
                                </h2>
                                <div class="space-y-4">
                                    <div class="flex items-center">
                                        <input type="radio" id="autoPass" name="reviewStatus" value="auto" checked
                                            class="w-4 h-4 text-primary focus:ring-primary border-gray-300">
                                        <label for="autoPass" class="ml-2 text-sm text-gray-700">自动通过审核（直接发布）</label>
                                    </div>
                                    <div class="flex items-center">
                                        <input type="radio" id="manualReview" name="reviewStatus" value="manual"
                                            class="w-4 h-4 text-primary focus:ring-primary border-gray-300">
                                        <label for="manualReview"
                                            class="ml-2 text-sm text-gray-700">需要人工审核（保存为待审核状态）</label>
                                    </div>
                                </div>
                            </div>

                            <!-- 操作按钮 -->
                            <div class="flex justify-end gap-3 pt-4 border-t border-gray-100">
                                <button type="reset"
                                    class="px-5 py-2 border border-gray-300 rounded-md bg-white text-gray-700 hover:bg-gray-50 transition-colors">
                                    重置
                                </button>
                                <button type="submit"
                                    class="px-5 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors">
                                    <i class="fa fa-save mr-1"></i> 保存资源
                                </button>
                            </div>
                        </form>
                    </div>

                    <!-- 提示信息 -->
                    <div class="bg-blue-50 border-l-4 border-primary p-4 rounded-md">
                        <h3 class="font-medium text-gray-800 flex items-center">
                            <i class="fa fa-lightbulb-o mr-2"></i> 资源添加提示
                        </h3>
                        <ul class="mt-2 text-sm text-gray-600 list-disc pl-5 space-y-1">
                            <li>请确保添加的资源链接有效且内容合规</li>
                            <li>资源描述应准确反映资源的实际功能和用途</li>
                            <li>选择正确的分类有助于用户更快找到资源</li>
                            <li>添加合适的标签可以提高资源的曝光率</li>
                        </ul>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <!-- 回到顶部按钮 -->
    <button id="backToTop"
        class="fixed bottom-6 right-6 w-12 h-12 rounded-full bg-primary text-white shadow-lg flex items-center justify-center opacity-0 invisible transition-all duration-300">
        <i class="fa fa-arrow-up"></i>
    </button>

    <script>
        // 回到顶部按钮功能
        const backToTopBtn = document.getElementById('backToTop');

        window.addEventListener('scroll', () => {
            if (window.scrollY > 300) {
                backToTopBtn.classList.remove('opacity-0', 'invisible');
                backToTopBtn.classList.add('opacity-100', 'visible');
            } else {
                backToTopBtn.classList.remove('opacity-100', 'visible');
                backToTopBtn.classList.add('opacity-0', 'invisible');
            }
        });

        backToTopBtn.addEventListener('click', () => {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });

        // 表单提交处理
        document.getElementById('resourceForm').addEventListener('submit', function (e) {
            e.preventDefault();

            // 在实际应用中，这里会有表单验证和数据提交逻辑
            alert('资源添加成功！');
            // 提交成功后跳转到资源管理列表页
            // window.location.href = 'admin_resource_manager.html';
        });

        // 移动端侧边栏切换
        document.querySelector('.md\\:hidden').addEventListener('click', function () {
            const sidebar = document.querySelector('aside');
            sidebar.classList.toggle('hidden');
            sidebar.classList.toggle('fixed');
            sidebar.classList.toggle('z-50');
            sidebar.classList.toggle('h-full');
            sidebar.classList.toggle('w-64');
        });
    </script>
</body>

</html>